
import { PipelineExecutor } from "./tools/pipelines/PipelineExecutor";
import { TilesetStages } from "./tools/pipelines/TilesetStages";
import { ContentStages } from "./tools/pipelines/ContentStages";
import { ContentDataTypes } from "./base";

async function createPipeline(input, output) {
    const optimizeGlbOptions = {
        dracoOptions: {
            compressionLevel: 10,
        },
    };

    const tilesetStageGlbToB3dm = TilesetStages.create(
        "_glbToB3dm",
        "Convert GLB to B3DM",
        [ContentStages.createGlbToB3dm()]
    );

    const tilesetStageOptimizeB3dm = TilesetStages.create(
        "_optimizeB3dm",
        "Optimize the GLB part of B3DM",
        [ContentStages.createOptimizeB3dm(optimizeGlbOptions)]
    );

    const overwrite = true

    await PipelineExecutor.executePipeline(
        {
            input: input,
            output: output,
            tilesetStages: [
                tilesetStageGlbToB3dm,
                tilesetStageOptimizeB3dm,
                TilesetStages.createGzip([
                    ContentDataTypes.CONTENT_TYPE_BDZM
                ])
            ]
        },
        overwrite
    );
}

createPipeline('./s_glb/', 'E:/umi-three-editor/public/result')


// ToolsMain.gzip('./out/', './out', true, true)